package com.dianping.cat.configuration.server.filter.transform;

import com.dianping.cat.configuration.server.filter.entity.AtomicTreeConfig;
import com.dianping.cat.configuration.server.filter.entity.CrashLogDomain;
import com.dianping.cat.configuration.server.filter.entity.ServerFilterConfig;
import org.xml.sax.Attributes;






public class DefaultSaxMaker
  extends Object
  implements IMaker<Attributes>
{
  public AtomicTreeConfig buildAtomicTreeConfig(Attributes attributes) {
/* 18 */     String startTypes = attributes.getValue("start-types");
/* 19 */     String matchTypes = attributes.getValue("match-types");
/* 20 */     AtomicTreeConfig atomicTreeConfig = new AtomicTreeConfig();

/* 22 */     if (startTypes != null) {
/* 23 */       atomicTreeConfig.setStartTypes(startTypes);
    }

/* 26 */     if (matchTypes != null) {
/* 27 */       atomicTreeConfig.setMatchTypes(matchTypes);
    }

/* 30 */     return atomicTreeConfig;
  }


  public CrashLogDomain buildCrashLogDomain(Attributes attributes) {
/* 35 */     String id = attributes.getValue("id");
/* 36 */     String title = attributes.getValue("title");
/* 37 */     CrashLogDomain crashLogDomain = new CrashLogDomain(id);

/* 39 */     if (title != null) {
/* 40 */       crashLogDomain.setTitle(title);
    }

/* 43 */     return crashLogDomain;
  }



/* 48 */   public String buildDomain(Attributes attributes) { throw new UnsupportedOperationException(); }




/* 53 */   public ServerFilterConfig buildServerFilterConfig(Attributes attributes) { return new ServerFilterConfig(); }






/* 60 */   public String buildTransactionName(Attributes attributes) { throw new UnsupportedOperationException(); }




/* 65 */   public String buildTransactionType(Attributes attributes) { throw new UnsupportedOperationException(); }



  protected <T> T convert(Class<T> type, String value, T defaultValue) {
/* 70 */     if (value == null || value.length() == 0) {
/* 71 */       return defaultValue;
    }

/* 74 */     if (type == Boolean.class || type == boolean.class)
/* 75 */       return (T)Boolean.valueOf(value); 
/* 76 */     if (type == Integer.class || type == int.class)
/* 77 */       return (T)Integer.valueOf(value); 
/* 78 */     if (type == Long.class || type == long.class)
/* 79 */       return (T)Long.valueOf(value); 
/* 80 */     if (type == Short.class || type == short.class)
/* 81 */       return (T)Short.valueOf(value); 
/* 82 */     if (type == Float.class || type == float.class)
/* 83 */       return (T)Float.valueOf(value); 
/* 84 */     if (type == Double.class || type == double.class)
/* 85 */       return (T)Double.valueOf(value); 
/* 86 */     if (type == Byte.class || type == byte.class)
/* 87 */       return (T)Byte.valueOf(value); 
/* 88 */     if (type == Character.class || type == char.class) {
/* 89 */       return (T)Character.valueOf(value.charAt(0));
    }
/* 91 */     return (T)value;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-core-3.0.0.jar!/com/dianping/cat/configuration/server/filter/transform/DefaultSaxMaker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */